<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="common/include :: header('客户拜访信息')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            关键字：<input type="text" placeholder="拜访原因" name="visitReason"/>
                        </li>
                        <li>
                            拜访方式：
                            <select name="visitType" th:with="type=${@dict.getType('bus_visit_type')}">
                                <option th:text="所有" value=""></option>
                                <option th:each="dict : ${type}" th:text="${dict.label}"
                                        th:value="${dict.value}"></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>拜访时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="yyyy/mm/日" name="startTime"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="yyyy/mm/日" name="endTime"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:post:add">
                <i class="fa fa-plus"></i> 新增
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="common/include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:post:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:post:remove')}]];
    var visitTypedatas = [[${@dict.getType('bus_visit_type')}]];
    var prefix = ctx + "/business/customerVisit";
    $(function () {
        var options = {
            url: prefix + "/query",
            createUrl: prefix + "/addPage",
            updateUrl: prefix + "/editPage?id={id}",
            removeUrl: prefix + "/remove",
            modalName: "服务单项",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '序号',
                    sortable: true
                },
                {
                    field: 'customer.customerName',
                    title: '客户',
                    sortable: true
                },

                {
                    field: 'linkmen.linkman',
                    title: '联系人',
                    sortable: true
                },
                {
                    field: 'visitReason',
                    title: '拜访原因',
                    sortable: true
                },
                {
                    field: 'visitType',
                    title: '拜访方式',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(visitTypedatas, value);
                    }
                },
                {
                    field: 'visitDate',
                    title: '拜访日期',
                    sortable: true,

                },
                {
                    field: 'content',
                    title: '交流情况',
                    align: 'center',

                },
                {
                    field: 'user.userName',
                    title: '录入人',
                    align: 'center',

                },
                {
                    field: 'inputTime',
                    title: '录入时间',
                    align: 'center',

                }]
        };
        $.table.init(options);
    });
    $('input[name=startTime]').datetimepicker({
        format:'yyyy-mm-dd',
        autoclose:true
    });
    $('input[name=endTime]').datetimepicker({
        format:'yyyy-mm-dd',
        autoclose:true
    });
</script>
</body>
</html>